<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
	<meta name="keywords" content="Nacos,monitor guide" />
	<meta name="description" content="Nacos monitor guide" />
	<!-- 网页标签标题 -->
	<title>Nacos monitor guide</title>
	<link rel="shortcut icon" href="https://img.alicdn.com/tfs/TB1hgJpHAPoK1RjSZKbXXX1IXXa-64-64.png"/>
	<link rel="stylesheet" href="/build/documentation.css" />
</head>
<body>
	<div id="root"><div class="documentation-page" data-reactroot=""><header class="header-container header-container-normal"><div class="header-body"><a href="/en-us/index.html"><img class="logo" src="/img/nacos_colorful.png"/></a><div class="search search-normal"><span class="icon-search"></span></div><span class="language-switch language-switch-normal">中</span><div class="header-menu"><img class="header-menu-toggle" src="/img/menu_gray.png"/><ul><li class="menu-item menu-item-normal"><a href="/en-us/index.html">HOME</a></li><li class="menu-item menu-item-normal menu-item-normal-active"><a href="/en-us/docs/quick-start.html">DOCS</a></li><li class="menu-item menu-item-normal"><a href="/en-us/blog">BLOG</a></li><li class="menu-item menu-item-normal"><a href="/en-us/community">COMMUNITY</a></li><li class="menu-item menu-item-normal"><a href="https://cn.aliyun.com/product/aliware/mse?spm=nacos-website.topbar.0.0.0">NACOS IN CLOUD</a><img class="menu-img" src="https://img.alicdn.com/tfs/TB1esl_m.T1gK0jSZFrXXcNCXXa-200-200.png"/></li><li class="menu-item menu-item-normal"><a href="http://console.nacos.io/nacos/index.html">DEMO-CONSOLE</a></li></ul></div></div></header><div class="bar"><div class="bar-body"><img src="/img/docs.png" class="front-img"/><div class="bar-title"><span>Documentation</span><div class="bone bone-light"></div></div><img src="/img/docs.png" class="back-img"/></div></div><section class="content-section"><div class="content-body"><div class="sidemenu"><div class="sidemenu-toggle"><img src="https://img.alicdn.com/tfs/TB1E6apXHGYBuNjy0FoXXciBFXa-200-200.png"/></div><ul><li class="menu-item menu-item-level-1"><span>Nacos </span><ul><li style="height:180px;overflow:hidden" class="menu-item menu-item-level-2"><span>What is Nacos<img style="transform:rotate(0deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/what-is-nacos.html" target="_self">What is Nacos</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/concepts.html" target="_self">Concepts</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/architecture.html" target="_self">Architecure</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/feature-list.html" target="_self">Feature list</a></li></ul></li><li style="height:324px;overflow:hidden" class="menu-item menu-item-level-2"><span>Quick Start<img style="transform:rotate(0deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/quick-start.html" target="_self">Nacos</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/quick-start-spring.html" target="_self">Nacos Spring</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/quick-start-spring-boot.html" target="_self">Nacos Spring Boot</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/quick-start-spring-cloud.html" target="_self">Nacos Spring Cloud</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/quick-start-docker.html" target="_self">Nacos Docker</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/use-nacos-with-dubbo.html" target="_self">Nacos with Dubbo</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/use-nacos-with-kubernetes.html" target="_self">Nacos with K8s</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-sync.html" target="_self">Nacos Sync</a></li></ul></li><li style="height:288px;overflow:hidden" class="menu-item menu-item-level-2"><span>User Guide<img style="transform:rotate(0deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/sdk.html" target="_self">Java SDK</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/other-language.html" target="_self">Other Language</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/open-api.html" target="_self">Open-API</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-spring.html" target="_self">Nacos Spring</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/system-configurations.html" target="_self">Nacos System Configurations</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/auth.html" target="_self">Authentication</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/faq.html" target="_self">FAQ</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Admin Guide<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/deployment.html" target="_self">Deployment Guide</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/cluster-mode-quick-start.html" target="_self">Cluster Mode Deployment</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/management-api.html" target="_self">Management OpenAPI</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/console-guide.html" target="_self">Admin Console Guide</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/monitor-guide.html" target="_self">Nacos Monitor Guide</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-config-benchmark.html" target="_self">Nacos Config Benchmark</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos2-config-benchmark.html" target="_self">Nacos2.0 Config Benchmark</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-naming-benchmark.html" target="_self">Nacos Naming Benchmark</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos2-naming-benchmark.html" target="_self">Nacos2.0 Naming Benchmark</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-sync-use.html" target="_self">Data Migration to Nacos</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Nacos 2.0<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/2.0.0-alpha.html" target="_self">2.0-BETA</a></li><li class="menu-item menu-item-level-3"><a href="/zh-cn/docs/2.0.0-upgrading.html" target="_self">Upgrading</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Contributor Guide<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/contributing.html" target="_self">Contribute to Nacos</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/contributing-flow.html" target="_self">Contributing Flow</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/pull-request.html" target="_self">Pull Request Template</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/how-to-reporting-bugs.html" target="_self">How to report bugs</a></li></ul></li><li style="height:36px;overflow:hidden" class="menu-item menu-item-level-2"><span>Community<img style="transform:rotate(-90deg)" class="menu-toggle" src="/img/arrow_down.png"/></span><ul><li class="menu-item menu-item-level-3"><a href="/en-us/docs/community.html" target="_self">Community</a></li><li class="menu-item menu-item-level-3"><a href="/en-us/docs/nacos-dev.html" target="_self">Develop Team</a></li></ul></li></ul></li></ul></div><div class="doc-content markdown-body"><h1>Nacos monitor guide</h1>
<p>Nacos 0.8.0 improves the monitoring system, supporting Nacos operation status monitoring through exposing metrics data access to third-party monitoring system. Currently, prometheus, elastic search and influxdb are supported. The docs introduce how prometheus and grafana monitor Nacos.
Here is Nacos <a href="http://monitor.nacos.io">grafana monitoring page</a>. You can find out for yourself how to use elastic search and influxdb.</p>
<h2>Deploy Nacos cluster to expose metrics data</h2>
<p>Deploy the Nacos cluster according to <a href="https://nacos.io/en-us/docs/deployment.html">the deploy document</a></p>
<p>Configure the application. properties file to expose metrics data</p>
<pre><code>management.endpoints.web.exposure.include=*
</code></pre>
<p>Access {ip}:8848/nacos/actuator/prometheus to see if metrics data can be accessed</p>
<h2>Deploy prometheus to collect Nacos metrics data</h2>
<p>Download the Prometheus version you want to install at the address of <a href="https://prometheus.io/download/">download prometheus</a></p>
<h3>linux &amp; mac</h3>
<p>Decompress prometheus compression package</p>
<pre><code>tar xvfz prometheus-*.tar.gz
cd prometheus-*
</code></pre>
<p>Modify configuration file prometheus.yml to collect Nacos metrics data</p>
<pre><code>    metrics_path: '/nacos/actuator/prometheus'
    static_configs:
      - targets: ['{ip1}:8848','{ip2}:8848','{ip3}:8848']
</code></pre>
<p>Start prometheus service</p>
<pre><code>./prometheus --config.file=&quot;prometheus.yml&quot;
</code></pre>
<h3>windows</h3>
<p>Download the corresponding version of Windows and decompress it</p>
<p>Modify configuration file prometheus.yml to collect Nacos metrics data</p>
<pre><code>    metrics_path: '/nacos/actuator/prometheus'
    static_configs:
      - targets:['{ip1}:8848','{ip2}:8848','{ip3}:8848']
</code></pre>
<p>Start prometheus service</p>
<pre><code>prometheus.exe --config.file=prometheus.yml
</code></pre>
<p>By accessing http://{ip}:9090/graph, we can see the data collected by prometheus. By searching nacos_monitor in the search bar, we can find Nacos data to show the success of the data collection.
<img src="https://img.alicdn.com/tfs/TB1LThVCQvoK1RjSZFwXXciCFXa-2832-1576.png" alt="IMAGE"></p>
<h2>Deploy grafana to graphically display metrics data</h2>
<p>Install grafana on the same machine as prometheus, and use yum to install grafana</p>
<h3>mac</h3>
<pre><code>brew install grafana
brew services start grafana
</code></pre>
<h3>linux</h3>
<pre><code>sudo yum install https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.4-1.x86_64.rpm
sudo service grafana-server start
</code></pre>
<h3>windows</h3>
<p>Reference document：<a href="http://docs.grafana.org/installation/windows/">http://docs.grafana.org/installation/windows/</a></p>
<p>Access grafana: http://{ip}:3000</p>
<p>Configuring prometheus data source
<img src="https://img.alicdn.com/tfs/TB1bTafCOLaK1RjSZFxXXamPFXa-2832-1568.png" alt="IMAGE"></p>
<p>Import Nacos grafana monitoring <a href="https://github.com/nacos-group/nacos-template/blob/master/nacos-grafana.json">template</a>
<img src="https://img.alicdn.com/tfs/TB1JadVCPDpK1RjSZFrXXa78VXa-2742-1338.png" alt="IMAGE"></p>
<p>Nacos monitoring is divided into three modules:</p>
<ul>
<li>nacos monitor shows core monitoring items
<img src="https://img.alicdn.com/tfs/TB1PMpUCQvoK1RjSZFDXXXY3pXa-2832-1584.png" alt="IMAGE"></li>
<li>nacos detail shows the change curve of index
<img src="https://img.alicdn.com/tfs/TB1ZBF4CNjaK1RjSZFAXXbdLFXa-2742-1480.png" alt="IMAGE"></li>
<li>nacos alert is alerts about nacos
<img src="https://img.alicdn.com/tfs/TB1ALlUCFzqK1RjSZFCXXbbxVXa-2742-1476.png" alt="IMAGE"></li>
</ul>
<h2>configure grafana alert</h2>
<p>When Nacos runs out of order, Grafana can alert the person in charge. Grafana supports a variety of police alert. Mail, DingTalk and webhook are commonly used.</p>
<h3>DingTalk alert</h3>
<p>Configure DingTalk robots
<img src="https://img.alicdn.com/tfs/TB1eJ0RCSzqK1RjSZFjXXblCFXa-2742-1482.png" alt="IMAGE"></p>
<p>Configure DingTalk robots url
<img src="https://img.alicdn.com/tfs/TB1ERtQCSzqK1RjSZFjXXblCFXa-2832-1578.png" alt="IMAGE"></p>
<p>Test alert
<img src="https://img.alicdn.com/tfs/TB1KvXPCHPpK1RjSZFFXXa5PpXa-996-504.png" alt="IMAGE"></p>
<h3>mail alert</h3>
<p>Modify defaults.ini configuration file to add mail alerts</p>
<pre><code>#################################### SMTP / Emailing ##########################
[smtp]
enabled = true
host = smtp.126.com:25
user = xxxxxx
password = xxxxx
;cert_file =
;key_file =
skip_verify = true
from_address = xxxxxx@126.com

[emails]
;welcome_email_on_sign_up = false
</code></pre>
<p>Configuration notification mailbox
<img src="https://img.alicdn.com/tfs/TB12qyhCNnaK1RjSZFtXXbC2VXa-2832-1576.png" alt="IMAGE"></p>
<h2>meaning of Nacos metrics</h2>
<h3>jvm metrics</h3>
<table>
<thead>
<tr>
<th>item</th>
<th>meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>system_cpu_usage</td>
<td>cpu usage</td>
</tr>
<tr>
<td>system_load_average_1m</td>
<td>load</td>
</tr>
<tr>
<td>jvm_memory_used_bytes</td>
<td>jvm memory used(bytes)</td>
</tr>
<tr>
<td>jvm_memory_max_bytes</td>
<td>jvm memory max(bytes)</td>
</tr>
<tr>
<td>jvm_gc_pause_seconds_count</td>
<td>gc count</td>
</tr>
<tr>
<td>jvm_gc_pause_seconds_sum</td>
<td>gc time</td>
</tr>
<tr>
<td>jvm_threads_daemon</td>
<td>jvm threads count</td>
</tr>
</tbody>
</table>
<h3>Nacos metrics</h3>
<table>
<thead>
<tr>
<th>item</th>
<th>meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>http_server_requests_seconds_count</td>
<td>http requests count</td>
</tr>
<tr>
<td>http_server_requests_seconds_sum</td>
<td>http requests time</td>
</tr>
<tr>
<td>nacos_timer_seconds_sum</td>
<td>Nacos config notify time</td>
</tr>
<tr>
<td>nacos_timer_seconds_count</td>
<td>Nacos config notify count</td>
</tr>
<tr>
<td>nacos_monitor{name='longPolling'}</td>
<td>Nacos config connection count</td>
</tr>
<tr>
<td>nacos_monitor{name='configCount'}</td>
<td>Nacos configuration file count</td>
</tr>
<tr>
<td>nacos_monitor{name='dumpTask'}</td>
<td>Nacos config dump task count</td>
</tr>
<tr>
<td>nacos_monitor{name='notifyTask'}</td>
<td>Nacos config notify task count</td>
</tr>
<tr>
<td>nacos_monitor{name='getConfig'}</td>
<td>Nacos config read configuration count</td>
</tr>
<tr>
<td>nacos_monitor{name='publish'}</td>
<td>Nacos config update configuration count</td>
</tr>
<tr>
<td>nacos_monitor{name='ipCount'}</td>
<td>Nacos naming ip count</td>
</tr>
<tr>
<td>nacos_monitor{name='domCount'}</td>
<td>Nacos naming domain count</td>
</tr>
<tr>
<td>nacos_monitor{name='failedPush'}</td>
<td>Nacos naming push fail count</td>
</tr>
<tr>
<td>nacos_monitor{name='avgPushCost'}</td>
<td>Nacos naming push cost time(average)</td>
</tr>
<tr>
<td>nacos_monitor{name='leaderStatus'}</td>
<td>Nacos naming if node is leader</td>
</tr>
<tr>
<td>nacos_monitor{name='maxPushCost'}</td>
<td>Nacos naming push cost time(max)</td>
</tr>
<tr>
<td>nacos_monitor{name='mysqlhealthCheck'}</td>
<td>Nacos naming mysql health check count</td>
</tr>
<tr>
<td>nacos_monitor{name='httpHealthCheck'}</td>
<td>Nacos naming http health check count</td>
</tr>
<tr>
<td>nacos_monitor{name='tcpHealthCheck'}</td>
<td>Nacos naming tcp health check count</td>
</tr>
</tbody>
</table>
<h3>nacos exception</h3>
<table>
<thead>
<tr>
<th>item</th>
<th>meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>nacos_exception_total{name='db'}</td>
<td>database exception</td>
</tr>
<tr>
<td>nacos_exception_total{name='configNotify'}</td>
<td>Nacos config notify exception</td>
</tr>
<tr>
<td>nacos_exception_total{name='unhealth'}</td>
<td>Nacos config server health check exception</td>
</tr>
<tr>
<td>nacos_exception_total{name='disk'}</td>
<td>Nacos naming write disk exception</td>
</tr>
<tr>
<td>nacos_exception_total{name='leaderSendBeatFailed'}</td>
<td>Nacos naming leader send heart beat fail count</td>
</tr>
<tr>
<td>nacos_exception_total{name='illegalArgument'}</td>
<td>request argument illegal count</td>
</tr>
<tr>
<td>nacos_exception_total{name='nacos'}</td>
<td>Nacos inner exception</td>
</tr>
</tbody>
</table>
<h3>client metrics</h3>
<table>
<thead>
<tr>
<th>item</th>
<th>meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>nacos_monitor{name='subServiceCount'}</td>
<td>subscribed services count</td>
</tr>
<tr>
<td>nacos_monitor{name='pubServiceCount'}</td>
<td>published services count</td>
</tr>
<tr>
<td>nacos_monitor{name='configListenSize'}</td>
<td>listened configuration file count</td>
</tr>
<tr>
<td>nacos_client_request_seconds_count</td>
<td>request count</td>
</tr>
<tr>
<td>nacos_client_request_seconds_sum</td>
<td>request time</td>
</tr>
</tbody>
</table>
<h2>Nacos-Sync monitor</h2>
<p>With the release of Nacos 0.9, Nacos-Sync 0.3 supports metrics monitoring. It can observe the running status of Nacos-Sync service through metrics data, and improve the monitoring capability of Nacos-Sync in production environment.
Reference for the Construction of the Overall Monitoring System <a href="https://nacos.io/en-us/docs/monitor-guide.html">Nacos Monitoring Manual</a></p>
<h2>grafana monitor Nacos-Sync</h2>
<p>The same as Nacos monitoring, Nacos-Sync also provides monitoring templates to import monitoring <a href="https://github.com/nacos-group/nacos-template/blob/master/nacos-sync-grafana">Nacos-Sync templates</a></p>
<p>Nacos-Sync monitoring is also divided into three modules:</p>
<ul>
<li>nacos-sync monitor shows core monitoring items
<img src="https://img.alicdn.com/tfs/TB1GeNWKmzqK1RjSZFHXXb3CpXa-2834-1588.png" alt="monitor"></li>
<li>nacos-sync detail and alert shows monitoring curves and alarms.
<img src="https://img.alicdn.com/tfs/TB1kP8UKbvpK1RjSZPiXXbmwXXa-2834-1570.png" alt="detail"></li>
</ul>
<h2>Nacos-Sync metrics meaning</h2>
<p>Nacos-Sync metrics is divided into JVM layer and application layer</p>
<h3>jvm metrics</h3>
<table>
<thead>
<tr>
<th>item</th>
<th>meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>system_cpu_usage</td>
<td>cpu usage</td>
</tr>
<tr>
<td>system_load_average_1m</td>
<td>load</td>
</tr>
<tr>
<td>jvm_memory_used_bytes</td>
<td>jvm memory used(bytes)</td>
</tr>
<tr>
<td>jvm_memory_max_bytes</td>
<td>jvm memory max(bytes)</td>
</tr>
<tr>
<td>jvm_gc_pause_seconds_count</td>
<td>gc count</td>
</tr>
<tr>
<td>jvm_gc_pause_seconds_sum</td>
<td>gc time</td>
</tr>
<tr>
<td>jvm_threads_daemon</td>
<td>jvm threads count</td>
</tr>
</tbody>
</table>
<h2>application metrics</h2>
<table>
<thead>
<tr>
<th>item</th>
<th>meaning</th>
</tr>
</thead>
<tbody>
<tr>
<td>nacosSync_task_size</td>
<td>sync task count</td>
</tr>
<tr>
<td>nacosSync_cluster_size</td>
<td>cluster count</td>
</tr>
<tr>
<td>nacosSync_add_task_rt</td>
<td>add task time</td>
</tr>
<tr>
<td>nacosSync_delete_task_rt</td>
<td>delete task time</td>
</tr>
<tr>
<td>nacosSync_dispatcher_task</td>
<td>dispatcher task time</td>
</tr>
<tr>
<td>nacosSync_sync_task_error</td>
<td>sync task error count</td>
</tr>
</tbody>
</table>
</div></div></section><footer class="footer-container"><div class="footer-body"><img src="/img/nacos_gray.png"/><div class="cols-container"><div class="col col-12"><h3>Vision</h3><p>By providing an easy-to-use service infrastructure such as dynamic service discovery, service configuration, service sharing and management and etc., Nacos help users better construct, deliver and manage their own service platform, reuse and composite business service faster and deliver value of business innovation more quickly so as to win market for users in the era of cloud native and in all cloud environments, such as private, mixed, or public clouds.</p></div><div class="col col-6"><dl><dt>Documentation</dt><dd><a href="/en-us/docs/what-is-nacos.html" target="_self">Overview</a></dd><dd><a href="/en-us/docs/quick-start.html" target="_self">Quick start</a></dd><dd><a href="/en-us/docs/contributing.html" target="_self">Developer guide</a></dd></dl></div><div class="col col-6"><dl><dt>Resources</dt><dd><a href="/en-us/community/index.html" target="_self">Community</a></dd><dd><a href="https://cn.aliyun.com/product/aliware/mse?spm=nacos-website.topbar.0.0.0" target="_self">Cloud Service MSE</a></dd><dd><a href="https://www.aliyun.com/product/edas?source_type=nacos_pc_20181219" target="_self">Cloud Service EDAS</a></dd><dd><a href="https://www.aliyun.com/product/ahas?source_type=nacos_pc_20190225" target="_self">Cloud Service AHAS</a></dd></dl></div></div><div class="copyright"><span>@ 2018 The Nacos Authors | An Alibaba Middleware (Aliware) Project</span></div></div></footer></div></div>
	<script src="https://f.alicdn.com/react/15.4.1/react-with-addons.min.js"></script>
	<script src="https://f.alicdn.com/react/15.4.1/react-dom.min.js"></script>
	<script>
		window.rootPath = '';
  </script>
	<script src="/build/documentation.js"></script>
</body>
</html>